version: '2'

services:
  discovery:
    build: ./discovery-service
    ports:
      - "8070:8070"

  gateway:
    build: ./gateway
    depends_on:
      - discovery
    environment:
      - EUREKA_CLIENT_SERVICE-URL_defaultZone=http://discovery:8070/eureka/
    ports:
      - "8080:8080"

  db:
    image: postgis/postgis
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=db

  sso:
    build: ./sso
    restart: always
    depends_on:
      - db
      - discovery
    environment:
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=password
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/db
      - IMAGE_STORE=
      - EUREKA_CLIENT_SERVICE-URL_defaultZone=http://discovery:8070/eureka/
    ports:
      - "8082:8082"

  layers_service:
      build: ./classifier-service/.
      restart: always
      depends_on:
        - db
        - sso
        - discovery
      environment:
        - SPRING_DATASOURCE_USERNAME=postgres
        - SPRING_DATASOURCE_PASSWORD=password
        - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/db
        - EUREKA_CLIENT_SERVICE-URL_defaultZone=http://discovery:8070/eureka/

  geodata:
    build: ./geodata/.
    restart: always
    depends_on:
      - db
      - sso
      - layers_service
    environment:
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=password
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/db
      - EUREKA_CLIENT_SERVICE-URL_defaultZone=http://discovery:8070/eureka/

  adminer:
    image: adminer
    ports:
      - "4040:8080"